#include <bits/stdc++.h>
#define int long long
using namespace std;
inline int read()
{
    int ans = 0, f = 0;
    char c = getchar();
    while (!isdigit(c))
        f |= c == '-', c = getchar();
    while (isdigit(c))
        ans = (ans << 3) + (ans << 1) + c - 48, c = getchar();
    return f ? -ans : ans;
}
void write(int x)
{
    if (x < 0)
        putchar('-'), x = -x;
    if (x > 9)
        write(x / 10);
    putchar(48 + x % 10);
}
const int N = 5e5 + 5;
int n;
struct que
{
    int op, f, t, b, k;
} q[N];
inline bool special()
{
    for (int i = 1; i <= n; ++i)
        if (q[i].op == 1 && q[i].t != 1)
            return 0;
    vector<int> a, v;
    for (int i = 1; i <= n; ++i)
    {
        if (q[i].op == 1)
            a.push_back(q[i].f + q[i].b), v.push_back(q[i].f + q[i].b);
        else
            a.erase(lower_bound(begin(a), end(a), v[q[i].k - 1]));
        sort(begin(a), end(a));
        int x = a[((int)a.size() + 1) / 2 - 1], ans = 0;
        for (int j : a)
            ans += j - x;
        write(ans), putchar('\n');
    }
    return 1;
}
signed main()
{
    freopen("love.in", "r", stdin);
    freopen("love.out", "w", stdout);
    n = read();
    for (int i = 1; i <= n; ++i)
        if ((q[i].op = read()) == 1)
            q[i].f = read(), q[i].t = read(), q[i].b = read();
        else
            q[i].k = read();
    if (special())
        return 0;
    vector<tuple<int, int, int>> a, v;
    auto sum = [&](double x)
    {
        double ans = 0;
        for (auto TIE : a)
        {
            int f, t, b;
            tie(f, t, b) = TIE;
            ans += abs(1.0 * t * (f - x) + b);
        }
        return ans;
    };
    for (int i = 1; i <= n; ++i)
    {
        if (q[i].op == 1)
            a.push_back({q[i].f, q[i].t, q[i].b}), v.push_back({q[i].f, q[i].t, q[i].b});
        else
            a.erase(lower_bound(begin(a), end(a), v[q[i].k - 1]));
        double ans = 1e18;
        for (auto Tie : a)
        {
            int f, t, b;
            tie(f, t, b) = Tie;
            double x = 1.0 * b / t + f;
            for (double j = x - 1e-3; j <= x + 1e-3; j += 1e-3)
                ans = min(ans, sum(j));
        }
        printf("%.10lf\n", ans);
    }
    return 0;
}